<template>
  <div>
    <Echart
      :options="options"
      id="centreLeft1Chart"
      height="174px"
      width="100%"
    ></Echart>
  </div>
</template>

<script>
  import Echart from '@/common/echart'
  export default {
    data () {
      return {
        options: {},
      };
    },
    components: {
      Echart,
    },
    props: {
      cdata: {
        type: Object,
        default: () => ({})
      },
    },
    watch: {
      cdata: {
        handler (newData) {
          this.options = {
            tooltip: {
              trigger: "item",
              formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            // calculable: true,
            legend: {
              orient: "vertical",
              y: "center",
              right: 10,
              data: newData.xData,
              textStyle: {
                color: "#fff"
              }
            },
            series: [
              {
                name: "通过率统计",
                type: "pie",
                radius: [10, 50],
                roseType: "radius",
                center: ["40%", "50%"],
                data: newData.seriesData
              }
            ]
          }
        },
        immediate: true,
        deep: true
      }
    }
  };
</script>

<style lang="scss" scoped>
</style>
